package cn.joeg.app.web.core.controller;

import cn.joeg.app.web.core.service.WidgetService;
import cn.joeg.app.web.core.vo.WidgetDataReq;
import cn.joeg.app.web.core.vo.WidgetDataResp;
import com.ecfront.dew.common.JsonHelper;
import com.ecfront.dew.common.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@Api(value = "个人信息查询Widget", description = "处理查询用户个人信息的widget")
@RequestMapping(value = "/widget/")
public class WidgetController {


    @Autowired
    private WidgetService widgetService;

    @PostMapping(value = "data/{code}")
    @ApiOperation(value = "根据Widget Code获取数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "Widget Code", paramType = "path", dataType = "string", required = true),
            @ApiImplicitParam(name = "vo", value = "数据对象", paramType = "body", dataType = "WidgetDataReq", required = true),
    })
    public Resp<WidgetDataResp> getDataByCode(@PathVariable String code, @RequestBody WidgetDataReq vo) {
        return widgetService.getDataByCode(code, vo);
    }




}
